package com.example.sxt_practise.IO;

import java.io.*;

/**
 * 打印流
 * @author gaofeng
 * @date 2022年05月11日 23:34
 */
public class PrintStreamTest {
    public static void main(String[] args) throws FileNotFoundException {
        PrintStream printStream = System.out ;
        printStream.println("辛酸泪");
        printStream.println(14);

        printStream = new PrintStream(new BufferedOutputStream(new FileOutputStream("src/IO/print.txt")), true) ;
        printStream.println("辛酸泪");
        printStream.println(14);
        printStream.println("其中味");
//        printStream.flush();
        printStream.close();

        // 重定向到输出端
        System.setOut(printStream);
        System.out.println("啦啦啦啦啦!");

        PrintWriter writer = new PrintWriter(new OutputStreamWriter(new OutputStream() {
            @Override
            public void write(int b) throws IOException {

            }
        })) ;
    }
}
